'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 9_study_pinecone_with_crud.py
* @Time: 2025/10/27
* @All Rights Reserve By Brtc
'''
import os

import dotenv
from langchain_openai import OpenAIEmbeddings
from langchain_pinecone import PineconeVectorStore


dotenv.load_dotenv()
#1、创建 embedding
embeddings = OpenAIEmbeddings(model="text-embedding-3-small")

#3、创建 db 对象
db = PineconeVectorStore(pinecone_api_key=os.getenv("PINECONE_API_KEY"),
                         index_name="brtc3class",
                         embedding=embeddings,
                         namespace="testdata")
# 删除
db.delete(["5e076286-91b2-45d2-bc15-e75c36f9cf54"])

# 获取实例
pincone = db.get_pinecone_index("brtc3class")

# 作业 完成一条数据的更新
pincone.update(id="xxxx", values=[], metadata={}, namespace="")